{include file="public/head"}
<div class="main">
    {include file="public/left"}
    <div class="middle">
    {include file="public/header"}
    <div class='userinfo'>
        {include file="public/userleft"}
        <div class="reputation">
           
        </div>
    </div>
    <div id="in_page" style="margin-left: 23%;"></div>
    {include file="public/foot"}
    </div>
    {include file="public/right"}
</div>
{include file="public/footer"}
<script>
    noLog();
    var total = 0;
    $(function(){
        creditLogData(1)
    })
    function creditLogData(nowpage){
        $.ajax({
            url:"/api/user/creditLogData",
            type:"get",
            data:{token:token,page:nowpage,limit:10},
            success:function(ret){
                var html = "";
                if(ret == '' || ret == null || ret == undefined){
                    return false;
                }
                if(ret['data'] == '' || ret['data'] == null || ret['data'] == undefined){
                    return false;
                }
                var userData = getLocalStorage('userData');
                var user = JSON.parse(userData);
                var len = ret['data'].length;
                for(i in ret['data']){
                    var integral = parseInt(ret['data'][i]['integral']);
                    if(integral<0){
                        var symbol = '';
                    } else {
                        var symbol = '+';
                    }
                    if(user['profile'] == '' || user['profile'] == null || user['profile'] == undefined){
                        user['profile'] = {};
                        user['profile']['avatar'] = '{$osslink}/static/index/image/index/avgdefaultsmall.jpg';
                    }

                    html += "<ul>";
                    html += "<li>";
                    html += "<img width='100%' src='"+user['profile']['avatar']+"'>";
                    html += "</li>";
                    html += "<li style='width:70%'>";
                    html += "<h6>"+user['username']+"<a><i class='layui-icon'>&#xe604;</i>"+symbol+ret['data'][i]['integral']+"</a></h6>";
                    html += "<span>"+ret['data'][i]['type_txt']+"</span>";
                    html += "</li>";
                    html += "<li style='font-size:12px;width:20%;text-align:right;flex-direction: column;align-self: center;'>"+ret['data'][i]['create_time']+"</li>";
                    html += "</ul>";
                }
                $(".reputation").html(html);
                total = ret['count'];
                if(nowpage == 1){
                    pagechange();
                }
            }
        });
    }
    function pagechange()
    {
        //分页
        createpage('in_page',total,10,function(obj,first){
            var nowpage = obj.curr;
            if(!first){
                creditLogData(nowpage);
            }
        });
    }
</script>